<template>
  <view class="page">
    <view v-if="list.length == 0" class="noneData"></view>
    <goodRow :list="list">
      <template #btns="{ item }">
        <view class="seeNum"> 浏览量:{{ item.see }} </view>
      </template>
    </goodRow>
  </view>
</template>
<script>
import goodRow from '../../components/goodRow.vue'
export default {
  components: { goodRow },
  data() {
    return {
      list: [],
      page: 1,
      total: 0
    }
  },
  onLoad() {
    this.getData()
  },
  onReachBottom(e) {
    if (this.list.length < this.total) {
      this.page++
      this.getData(true)
    }
  },
  methods: {
    getData(type) {
      if (!type) {
        this.list = []
      }
      var that = this
      this.$http({
        url: 'getViewList',
        method: 'get',
        data: { page: that.page }
      }).then(res => {
        this.total = res.data.total
        let arr1 = res.data.data.map(el => {
          // let arr = el.url.split(',')
          // arr.some(item => {
          //   if (!item.endsWith('.mp4')) {
          //     el.thumb_image = item
          //     return true
          //   } else {
          //     el.video = item
          //   }
          // })
          if (el.thumb_image.endsWith('.mp4')) el.thumb_image = el.thumb_image2
          return el
        })
        that.list.push(...arr1)
      })
    }
  }
}
</script>
<style lang="scss" scoped>
@import '../common/common.css';
.page {
  position: relative;
  width: 100%;
  background-color: #f8f8f8;
  min-height: 99vh;
  padding: 0 2.5%;
  overflow: hidden;
  overflow-y: scoll;
  padding-bottom: 50px;
}

.seeNum {
  font-size: 12px;
  color: #999999;
  float: right;
}
</style>
